package com.seckillpro.seckill_pro.rabbtmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Package: com.seckillpro.seckill_pro.rabbtmq
 * @ClassName: MQSender
 * @Author: lyx
 * @CreateTime: 2021/3/26 17:13
 * @Description:
 */
@Slf4j
@Service
public class MQSender {

    @Autowired
    private RabbitTemplate rabbitTemplate;
//    public void send(Object msg){
//
//        log.info("发送消息： " + msg);
//        //发送消息
//        rabbitTemplate.convertAndSend("queue",msg);
//    }


    /**
     * 发送秒杀信息
     *
     * @param message
     */

    public void sendSeckillMessage(String message) {
        log.info("发送消息" + message);
        rabbitTemplate.convertAndSend("seckillExchange", "seckill.message", message);
    }
}
